<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = 'abcdefg'
        // 将字符串转成数组
        var strs = str.split('')
        // 用reverse()对数组进行倒序，在用join('')将数组转成字符串
        var res = strs.reverse().join('')
        console.log(res)
    </script>
</body>
</html>